import React, { useEffect, useState } from 'react';
import { useHistory } from "react-router-dom";
import {
  List, DatePicker, Picker, Modal, Button,
  InputItem, TextareaItem, Toast, Flex, Switch, Drawer,Accordion, Card
} from 'antd-mobile';
import Btn from "../../../components/btn/Btn";
import './registrationEdit.less';
import UserMsg from "../../outUser/userMsg/UserMsg";
import http from "../../../model/http";
import { dateFormat, sendMsg } from "../../../model/code";
import Header from "../../../components/header/Header";
import { Calendar } from 'react-h5-calendar'; 
const Item = List.Item,
  _now = new Date(),
  tomorrow = new Date(_now.getTime() + 24 * 3600 * 1000);

function Edit2() {
  const history = useHistory(),
    { outUser } = history.location.state;
  console.log(outUser)
  // 仪器列表
  const [instrumentList, setInstrumentList] = useState([]);
  const [instrument, setInstrument] = useState([-1]);
  // 麻醉类型
  const [hocustList, setHocusList] = useState([{ label: '全麻', value: 2 }, { label: '局麻', value: 1 }]);
  const [hocus, setHocus] = useState([-1]);

  // 医生列表
  const [doctorList, setDoctorList] = useState([]);
  const [doctor, setDoctor] = useState([-1]);
  const [doctor2, setDoctor2] = useState([-1]);

  // 项目次数
  const [count, setCount] = useState('1')
  const nowTimeStamp = new Date();
  //治疗日期
  const [date, setDate] = useState('');
  const [time2, setTime2] = useState('00:00');
  const [time3, setTime3] = useState('00:00');

  //自行填写时间点
 const [timeView1, setTimeView1] = useState();
 const [timeView2, setTimeView2] = useState();
  // 治疗时长
  const [time, setTime] = useState('2');
  // 治疗时长-失去焦点更新
  const [timeBlur, setTimeBlur] = useState(true);
  // 治疗时间
  const [time4, setTime4] = useState(0);
  // 时间段
  const [time5, setTime5] = useState(['', '']);
  // 时间段列表
  const [timeList, setTimeList] = useState([]);
  // 时间段弹窗
  const [time1, setTime1] = useState(false);
  // 单个可选时间段
  const [timeIdx, setTimeIdx] = useState({ _show: false });
  // 备注
  const [mark, setMark] = useState('')
  // 是否已检
  const [switchIscheck, setSwitchIscheck] = useState(false)
  // 是否缴费
  const [switchIsmoney, setSwitchIsmoney] = useState(false)
  

  // 治疗时长
  const [bookingTime, setBookingTime] = useState(0)

  // 治疗项目
  const [itemDisplayName, setItemDisplayName] = useState('')
  // 选择治疗医生之后显示列表
  const [doctorDayShow,setDoctorDayShow] = useState(false)

  // 遮罩层
  const [doctorDayListShow, setDoctorDayListShow] = useState(false)

  // 遮罩层里面的日期 默认今日 
  const [dateValue, setDateValue] = useState(nowTimeStamp) 
  const [doctorListData,setDoctorListData] = useState([]) 
  const [doctorTimeTitle,setDoctorTimeTitle] = useState('')
  // 时间列表
  const [timeDataList,setTimeDataList] = useState([])
  const [timeDataListShow, setTimeDataListShow] = useState(false)
  const [active,setActive] = useState(-1)

  // 当日轮牌
  const [dailyRotation, setDailyRotation] = useState(false)
  // 执行科室
  const [departmentList, setDepartmentList] = useState([])
  const [department, setDepartment] = useState([-1])
  const [doctorShow, setDoctorShow] = useState(false)
  const [doctorName, setDoctorName] = useState('')
  
  useEffect(() => {
    (async () => {
      // if (!doctorList.length) {
      //   // const _doctor = await http.post('/customer/doctorList');
      //   http.get('/expert/list', {
      //     hosId: window.hos.hosId,
      //   }).then(res => {
      //     if (res.code == '0') {
      //       setDoctorList(res.data)
      //     }
      //   })
      // } 
      setDepartmentList([
        {label:'整形中心',value:'DE0011'},
        {label:'皮肤中心',value:'DE0012'},
        {label:'无创中心',value:'DE0013'},
        {label:'口腔中心',value:'DE0014'},
        {label:'植发中心',value:'DE0015'}, 
      ])
      // 仪器列表 
      const instrumentListData = await http.post('/scheduler/getDeviceList',{
        deptId:'DE0012',
      })
      let newLabel = instrumentListData.data.map(item => {
        return {
          label: item.equipment_name,
          value: item.tgb_armarium_id
        }
      })
      setInstrumentList(newLabel)

      if (timeBlur && instrument[0] > 0 && doctor[0] > 0 && time > 0) {
        const _timeList = await http.post('/customer/getAllSchedulerTime', {
          customerCrmId: outUser.customerCrmId,
          expertId: doctor[0],
          instrumentId: instrument[0],
          sdate: dateFormat(date, 'yyyy-MM-dd'),
          curetimelong: time
        })
        const _timeStart = _timeList.data.find(i => i.isBlank).start;
        const _stamp = new Date(_timeStart.replace(/-/g, '/'));
        const _timeStr = [dateFormat(_stamp, 'hh:mm'), dateFormat(new Date(_stamp.getTime() + time * 60 * 1000), 'hh:mm')];

        setTimeList(_timeList.data.map(i => { i._start = new Date(i.start); i._end = new Date(i.end); return i }));
        setTime5(_timeStr);
      }
    })()

    // eslint-disable-next-line
  }, [doctor, instrument, date, timeBlur])



  const showSelectTime = item => {
    if (!item.isBlank) return;
    setTimeIdx({ minDate: item._start, maxDate: item._end, show: true, _show: true });
  }
  const selectTime = _date => {
    setTimeIdx({ _show: false }); setTime1(false);
    if (!_date) return;
    setTime5([dateFormat(_date, 'hh:mm'), dateFormat(new Date(_date.getTime() + time * 60 * 1000), 'hh:mm')]);
  }

  // 解决 ios 时间控
  const changeDateAndriodIos = (value) => {
    let arr = value.split(/[- : -]/);
    const date = new Date(arr[0], arr[1]-1, arr[2], arr[3], arr[4], arr[5]);
    return date;
  }

  const submit = (status) => {
    // history.push('/yuyue/notice2');
    // if(instrument[0]<0){Toast.fail('请选择仪器');return};

    // if(department == 'DE0012'){
    //   if(instrument[0] === -1){Toast.fail('请选择仪器');return};
    // }

    if (doctor[0] < 0) { Toast.fail('请选择医生'); return };
    if (hocus[0] < 0 && department == 'DE0011') { Toast.fail('请选择麻醉类型'); return }
    if (itemDisplayName.replace(/\s*/g, '') == '') { Toast.fail('请输入预约的项目内容'); return }
    if (date == '') { Toast.fail('请选择治疗日期'); return }
    if(bookingTime == 0  && department =="DE0011") {Toast.fail('请选择治疗时间'); return}

    if(department !='DE0011' && (  !timeView1  && !timeView2 ) ){ Toast.fail('请选择开始时间或结束时间'); return  }
    // if(!time5[0]){Toast.fail('请选择时间段');return};
    console.log(instrument[0])
    Modal.alert('提示', '确认预约', [
      { text: '取消' },
      {
        text: '预约', onPress: async () => {
          const order = await http.post('/customer/manual_schedule', {

            
            manual_trname: itemDisplayName, // 手工录入的项目名称
            manual_schdate: dailyRotation?date:dateFormat(date, 'yyyy-MM-dd'), // 治疗日期
            // manual_schtime: dateFormat(time2, 'yyyy-MM-dd hh:mm'), // 到院日期           
            // manual_schtime: dateFormat(new Date(`${dailyRotation?date:dateFormat(date, 'yyyy-MM-dd').replace(/-/g, "/")} ${time2}`), 'yyyy-MM-dd hh:mm:ss'),

            manual_schtime:
            department =="DE0011" ?
            (dailyRotation?(`${date} ${time2}`) :(dateFormat(new Date(`${dateFormat(date, 'yyyy-MM-dd').replace(/-/g, "/")} ${time2}`), 'yyyy-MM-dd hh:mm:ss'))):
            dateFormat(date, 'yyyy-MM-dd')+" "+dateFormat(timeView1, 'hh:mm')+":00",
            
            manual_schtime_end: department =="DE0011" ?"": dateFormat(date, 'yyyy-MM-dd')+" "+dateFormat(timeView2, 'hh:mm')+":00",
            

            expertId: doctor[0],
            deptId: department,
            instrumentId: instrument[0] !== -1 ? instrument[0] : '',
            // instrumentId:'',
            expertId2: doctor2[0] > 0 ? doctor2[0] : '',
            // hocusType: hocus[0] < 0 ? '' : hocus,
            
            hocusType:department =='DE0011' ? hocus :[-1],

            customerCrmId: outUser.customerCrmId,   // 顾客id
            customerCrmName: outUser.customerName,  // 顾客姓名
            ischeck: switchIscheck ? 1 : 0,
            ismoney: switchIsmoney ? 1 : 0,
            estimate_time: bookingTime,
            memo: mark,
            is_auto: dailyRotation?1:0
          });
          if(order.code == 0){
            if (status == '1') {
              const link = `${window.location.origin}/outUser/yuyue2?hosId=${window._user.hosId}&crmId=${outUser.customerCrmId}&orderId=${order.schedulerId}`;
              sendMsg(link, '预约治疗', '待确认');
            } else {
              Toast.success(order.msg)
              setTimeout(() => {
                history.push('/yuyue')
              }, 500);
            }
          }else{
            Toast.fail(order.msg)
          }
           
        }
      },
    ])
  }
  const showhtml = (htmlString) => {
    var html = { __html: htmlString };
    return <div dangerouslySetInnerHTML={html}></div>;
  }

  // 手术时长 请求
  const getDurationFunc = async(d,hoc,v=doctor) => {
    const timeDataList = await http.post('/scheduler/checkScheduleTimeAuto',{
      expertId: v[0],
      sch_date: d,
      hocusType: hoc,
      customerCrmId: outUser.customerCrmId,   // 顾客id
      deptId: department[0]
    })
    if(timeDataList.code == 0){
      setDate(new Date(d))
      setTimeDataListShow(true)
      setTimeDataList(timeDataList.data)
      setTime2('00:00')
      setTime3('00:00')
      setBookingTime(0)
      setActive(-1)
    }else{
      Toast.fail(timeDataList.msg);
    }
  }
  // 通过点击日期去获取手术时长
  const getDuration = async (d) => {
    if (doctor[0] < 0) { Toast.fail('请先选择治疗医生'); return };
    if (hocus[0] < 0 && department=="DE0011") { Toast.fail('请先选择麻醉类型'); return }; 
   

    getDurationFunc(dateFormat(d, 'yyyy-MM-dd'), hocus)
    
  }
  
  // 通过点击麻醉类型获取时长
  const getDuration2 = async (v) => { 
    setHocus(v) 
    if(dailyRotation == true){   
      getTodayQueueDataFunc(department[0] , v)
    }

    if(doctor[0] < 0 || date == ''){
      return false;
    }
    getDurationFunc(dateFormat(date, 'yyyy-MM-dd'),v)
    
    
  }

  // doctorTimeList
  const doctorTimeListFunc = async(doc, t) => {
    const getDoctorDayList = await http.post('/scheduler/getExpertTrTime',{
      expertId: doc,
      sch_date: t, 
    })  
    if(getDoctorDayList.code == '0'){
      setDoctorListData(getDoctorDayList.data) 
      setDoctorTimeTitle(getDoctorDayList.pbname) 
    }
  }

  
  
  // 选择治疗医生之后弹出框
  const getDoctorDay = async (v) => {
    if (department[0] < 0) { Toast.fail('请先选择执行科室'); return };
    // 赋值
    setDoctor(v)
    // 显示
    setDoctorDayShow(true) 
    console.log(v)
    doctorTimeListFunc(v[0],dateFormat(nowTimeStamp, 'yyyy-MM-dd'))

    if(date!=''){
      getDurationFunc(dateFormat(date, 'yyyy-MM-dd'), hocus, v)     
    }  
  } 
  
  
  // 查看手术弹框
  const operationSearch = () =>{
    setDoctorDayListShow(true) 

    document.body.addEventListener("touchmove", window.scroll, {passive: false });
    document.body.style.overflow = 'hidden';
  }

  // 右边弹框
  const onOpenChange = () => { 
    setDoctorDayListShow(!doctorDayListShow)
    // 弹框关闭的时候 恢复body 滚动条
    if(doctorDayListShow == true){ 
      //添加事件监听时添加了passive参数，在ios9中移除事件监听也需要加此参数
      document.body.removeEventListener('touchmove', window.scroll,{passive: true});
      document.body.style.overflow = 'auto';
    }
  }

  // 点击弹框里面的日期
  const onDateClick = (d) => { 
    setDateValue(dateFormat(d.$d, 'yyyy-MM-dd'))   
    doctorTimeListFunc(doctor[0],dateFormat(d.$d, 'yyyy-MM-dd'))
  }

  // 点击按钮渲染时间
  const timeBtnClick = (value,index) => {
    console.log(value)
    setTime2(value.begin)
    setTime3(value.end)
    let time2Num = new Date((`${dateFormat(date, 'yyyy-MM-dd')} ${value.begin}`).replace(/-/g, "/")).getTime()
    let time3Num = new Date((`${dateFormat(date, 'yyyy-MM-dd')} ${value.end}`).replace(/-/g, "/")).getTime() 
    setBookingTime(new Date(Number(time3Num) - Number(time2Num))/(1000*60))

    setActive(index)
  }
   
  
  // 当日轮排
  const rotationChange = async () => {
    if (hocus[0] < 0) { Toast.fail('请先选择麻醉类型'); return }; 
    if (department[0] < 0) { Toast.fail('请先选择执行科室'); return };
    setTimeDataListShow(false)
    setDoctorDayShow(false)
    setDailyRotation(!dailyRotation)
    if(!dailyRotation == true){
      console.log('触发')
      console.log(hocus)

      getTodayQueueDataFunc(department[0])
      
    }else{
      setDate('')
      setTime2('00:00')
      setTime3('00:00') 
      setBookingTime(0)
      setDoctor([-1])
    }
  }
  // 轮排的时候调用接口 
  const getTodayQueueDataFunc = async (did, type = hocus[0]) => { 
    const result = await http.post('/expert/todayQueueData',{
      deptId: did,
      hocusType: type
    })
    console.log(result)
    setDate(result.date)
    setTime2(result.oktime_begin!=''?result.oktime_begin:'00:00')
    setTime3(result.oktime_end!=''?result.oktime_end:'00:00') 
    setBookingTime(result.cure_long_minute) 
    setDoctor([result.expertId!=''?result.expertId:-1])
    setDoctorName(result.expertName!=''?result.expertName:'当日暂无轮排医生')
  }

  // 执行科室
  const getDepartmentChange = async (value) => {
    console.log(value)
    if(value == 'DE0012'){
      // 麻醉类型
      setHocusList([{ label: '表麻', value: 3 }, { label: '局麻', value: 1 }]); 
    }else{
      setHocusList([{ label: '全麻', value: 2 }, { label: '局麻', value: 1 }]); 
    }
    setHocus([-1])
    setDepartment(value)
    // http://wxwork.gzsg.cn/wxwork/manager/getDeptPersonList?hosId=1&userId=xx&managerId=1629697426248&deptId=DE0011&userType=3
    const result = await http.post('/manager/getDeptPersonList',{
      deptId:value,
      userType:3
    })
    if(result.code == 0){
      let newData = result.data.map(item => {
        return {
          label: item.name,
          value: item.erp_id
        }
      })
      setDoctorList(newData)
      setDoctor([-1])
      // 显示
      setDoctorDayShow(false)
      setDoctorShow(true)
    }

    // 如果排班不等于空
    if(dailyRotation != false){
      getTodayQueueDataFunc(value[0])
    }
  }
  

  return (
    <div className='v-yueyu-registrationEdit'>
      <UserMsg msg={outUser} />

      <List className='g-p5-10 g-bg-f g-bdrs12 g-mb10'>
        {/* <Item wrap extra={showhtml(item.displayname)} className="edit2-treatment-items">治疗项目</Item> */}
        <Picker
          cols={1}
          title="执行科室"
          data={departmentList}
          value={department}
          onOk={(v) => getDepartmentChange(v)}
        >
          <Item arrow="horizontal"><Flex>执行科室  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex></Item>
        </Picker>

        {
          department =="DE0011" ? (
            <Picker data={hocustList} cols={1}
            value={hocus} onOk={v => getDuration2(v)}>
            <Item arrow="horizontal"><Flex>麻醉类型  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex></Item>
          </Picker>
          ):null
        }

       

        <Item
          extra={
            <Switch
              checked={switchIscheck}
              onChange={() => setSwitchIscheck(!switchIscheck)}
            />}
        >是否已检
        </Item>

        <Item
          extra={
            <Switch
              checked={switchIsmoney}
              onChange={() => setSwitchIsmoney(!switchIsmoney)}
            />}
        >是否缴费
        </Item>


        {
          department =="DE0011"?(
            <Item
            extra={
              <Switch
                checked={dailyRotation}
                onChange={() => rotationChange()}
                color="#108ee9"
              />}
          >当日轮排
          </Item>
          ):null
        }


        {!dailyRotation && doctorShow ? (
          <Picker
            cols={1}
            title="治疗医生"
            data={doctorList}
            value={doctor}
            onOk={(v) => getDoctorDay(v)} 
          >
            <Item arrow="horizontal"><Flex>治疗医生  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex></Item>
          </Picker>
        ):''}

        {department == 'DE0012' && (
            <Picker data={instrumentList} cols={1}
                value={instrument} onOk={v=>{setInstrument(v)}}>
              <Item arrow="horizontal">治疗仪器</Item>
            </Picker>
        )}
        

        {dailyRotation && doctorShow ?(<InputItem type='string' disabled value={doctorName}  
          moneyKeyboardAlign='right' className="input-css">治疗医生
        </InputItem>):''}
        

        {doctorDayShow && !dailyRotation && doctorShow ? 
          <Item   
            extra={
              <div style={{color:'#6495ED'}}>查看手术</div>
            }
            onClick={() => operationSearch()}
          >手术
          </Item>
          : ''
        }
        {!dailyRotation && doctorShow ? (
          <Picker
            cols={1}
            title="其他医生"
            data={doctorList}
            value={doctor2}
            onOk={v => setDoctor2(v)} 
          >
            <Item arrow="horizontal">其他医生</Item>
          </Picker>
        ):''}
        {!dailyRotation && (
          <DatePicker mode="date" value={date} extra='请选择'
            minDate={_now} onOk={(d) => getDuration(d)}>
            <Item arrow="horizontal"><Flex>治疗日期  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex></Item>
          </DatePicker>
        )}
        
        {dailyRotation &&(<InputItem type='string' disabled value={date}  
          moneyKeyboardAlign='right' className="input-css">治疗日期
        </InputItem>)}
        

        
        
        {timeDataListShow && !dailyRotation && department =='DE0011' ? 
          <div style={{paddingRight:'15px',marginBottom:'5px'}}>
            <Flex className="time-box-title">
              <p>选择治疗时间：</p>
              <span>点击红色可约选择时间</span>
            </Flex>
            {timeDataList.map((item,index) => ( 
              <div className={active==index?'time-width-style-active time-width-style':'time-width-style'}>
                <Flex onClick={() => item.tipsvalue>0?timeBtnClick(item,index):''}>
                  <span className="time-style" style={{"fontSize":"16px"}}>{item.begin}-{item.end}</span>
                  <button className="btn-style" 
                    disabled={item.tipsvalue>0?false:true} 
                    style={item.tipsvalue>0?{backgroundColor:'#e60012'}:(item.tipsvalue==-1?{backgroundColor:'#1b1b1b'}:{backgroundColor:'#a0a0a0'})}
                    
                  >{item.tips}</button>
                </Flex>
              </div> 
            ))}
            
            <div className="clear"></div>
          </div>
        : ''}

        {/* 自行填写时间 */}
        {
           (department =='DE0012' || department =='DE0013' || department =='DE0014' || department =='DE0015' )?(
              <DatePicker  mode="time" value={timeView1}
             
              onChange={d => {
                setTimeView1(d);
                let time1Num = new Date(d).getTime()
                let time2Num = new Date(timeView2).getTime()
                if (Number(time1Num) > Number(time2Num)) {
                  setTimeView2(d)
                }
              } 
              }>
              <Item arrow="horizontal"> <Flex>开始时间  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex>    </Item>
            </DatePicker>
           ):null

        }

       {
           (department =='DE0012' || department =='DE0013' || department =='DE0014' || department =='DE0015' )?(
            <DatePicker  mode="time" value={timeView2}
             minDate={timeView1} onChange={d => {
              setTimeView2(d)
              
            }}>
            <Item arrow="horizontal"><Flex>结束时间  <b style={{color:'red',marginTop:'-10px'}}>*</b></Flex> </Item>
          </DatePicker>
           ):null

        }





        {
          department =="DE0011"?(
            <InputItem type='string' disabled value={time2} 
            onChange={v => { setTime2(v) }}
            moneyKeyboardAlign='right' className="input-css">开始时间
          </InputItem>
          ):null
        }

       {
          department =="DE0011"?(
            <InputItem type='string' disabled value={time3} 
          onChange={v => { setTime3(v) }}
          moneyKeyboardAlign='right' className="input-css">结束时间
        </InputItem>
          ):null
        }

        
       
       

        


        {/* <InputItem type='number' value={time-0}
                   onBlur={()=>{setTimeBlur(true)}}
                   onChange={v=>{setTimeBlur(false);setTime(v)}}
                   moneyKeyboardAlign='right' extra="分钟">治疗时长</InputItem> */}


        {
          department =="DE0011"?(
            <InputItem type='number' value={bookingTime}
            onBlur={() => { setTimeBlur(true) }}
            onChange={v => { setTimeBlur(false); setBookingTime(v) }}
            moneyKeyboardAlign='right' extra="分钟" className="input-css" disabled>治疗时长</InputItem>
  
          ):null
        }


      
        {/* <InputItem type='number' value={count-0}
                   onChange={v=>{setCount(v>item.wzcs?item.wzcs:v)}}
                   moneyKeyboardAlign='right' extra="次">项目次数</InputItem> */}

        {/* <Item extra={<div className='g-flex g-x-between'>
          <Button onClick={()=>{setTime4(1)}} type={time4===1?'primary':''} size='small'>智能分配</Button>
          <Button onClick={()=>{setTime4(2)}} type={time4===2?'primary':''}  size='small'>手动选择</Button>
        </div>}>治疗时间</Item> */}

        {/* <Item extra={time5.join('-')} onClick={showModal} arrow="horizontal">时间段</Item> */}

      </List>

      <List className='g-p5-10 g-bg-f g-bdrs12' style={{ marginBottom: '10px' }}>
        <TextareaItem value={itemDisplayName} rows={5} count={100} onChange={v => setItemDisplayName(v)} placeholder='请输入治疗项目...' className="input-css" />
      </List>

      <List className='g-p5-10 g-bg-f g-bdrs12'>
        <TextareaItem value={mark} rows={5} count={100} onChange={setMark} placeholder='请输入备注信息...' className="input-css" />
      </List>
      {/* <Flex> 
        <Flex.Item><Btn type='primary' onClick={() => submit('1')} className="edut2-operation-button">确定并发送给顾客</Btn></Flex.Item>
      </Flex> */}
      <Flex>
        <Flex.Item><Btn type='warning' onClick={() => submit('2')} className="edut2-operation-button">仅提交保存</Btn></Flex.Item>
      </Flex>


      <Modal popup className='v-yueyu-edit2'
        visible={time1}
        animationType='slide-up'
        onClose={() => { setTime1(false) }}>
        <div className='v-time1 g-flex'>
          {timeList.map((i, idx) => (
            <div className='v-time1-item g-l g-ta-c g-box'
              onClick={() => { showSelectTime(i) }} key={idx} >
              <p className='v-time1-item2 g-r' style={{ background: i.isBlank ? '#108ee9' : '#A0A0A0' }}>
                {i.isBlank ? '预约' : '约满'}
              </p>
              {dateFormat(i._start, 'hh:mm')}-{dateFormat(i._end, 'hh:mm')}
            </div>
          ))}
        </div>
      </Modal>
      {timeIdx._show ? <DatePicker visible={timeIdx.show} mode="time" value={date}
        minDate={timeIdx.minDate} maxDate={timeIdx.maxDate}
        onOk={selectTime} onDismiss={selectTime} /> : null}


      {/* 右边弹出 */}
      {doctorDayListShow ? <Drawer
        className="my-drawer"
        style={{ minHeight: document.documentElement.clientHeight,position:'fixed' }}
        enableDragHandle
        contentStyle={{ color: '#A6A6A6', textAlign: 'center', paddingTop: 42 }}
        sidebar={
          <div className="yuyue-edit2-doctor-box">
            <Calendar 
              onDateClick={(d) => onDateClick(d)}
              showType={'month'}
              markDates={[]}
              markType="dot"
              currentDate={dateValue} 
            />

            <div className="doctor-box-accordion"> 
              <div className="doctor-box-accordion-title">{doctorTimeTitle}</div>
              {doctorListData.length> 0 ? doctorListData.map((item,idx) => (
                <Card>
                  <Card.Body>
                    <div className="edit-card">
                      <h1>时间：{item.sch_date} {item.begin_time} ~ {item.end_time}</h1> 
                      <p>手术：<span>{showhtml(item.trnames)}</span></p>
                    </div>
                  </Card.Body>
                  <Card.Footer content={<span>麻醉类型：{item.hocusTypeName}</span>} extra={<div>时长：{item.estimate_time}分钟</div>} />
                </Card>))
              :''}
              
            </div>
          </div>

          
        }
        open={doctorDayListShow}
        onOpenChange={() => onOpenChange()}
      > 
      </Drawer>
      :''}
      
      
      <Header />  
    </div>
  )

}

export default Edit2;

/*
  const [time2,setTime2] = useState(false);

    const modalFooter = [
    {
      text: '取消',
      onPress:()=>{
        setTime1(false)
        setTime2(false)
      }
    },{
      text: '确定',
      onPress:()=>{
        setTime1(false)
        setTime2(false)
      }
    }
  ]

      <Modal transparent
             className='v-yueyu-edit2'
             title='治疗时间'
             visible={time2}
             footer={modalFooter}
             onClose={()=>{setTime2(false)}}>
        <div className='v-time2 g-ta-c'>
          <div className='g-ov g-mb10'>
            <p className='g-l v-w40'>起始时间</p>
            <p className='g-l v-w60' onClick={() => {setTime3(true)}}>11:16</p>
          </div>
          <div className='g-ov g-mb10'>
            <p className='g-l v-w40'>结束时间</p>
            <p className='g-l v-w60'>11:16</p>
          </div>
        </div>
      </Modal>
 */